package cn.tedu.charging.common.enums;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * 记录当前充电的所有尖峰平谷的名字
 */
@NoArgsConstructor
@AllArgsConstructor
public enum CostRuleEnum {
    AM_TIP(8,12,"上午尖"),
    PM_TIP(14,18,"下午尖"),
    PEAK(18,24,"峰"),
    FLAT(12,14,"平"),
    VALLY(0,8,"谷");
    private Integer startHour;
    private Integer endHour;
    private String name;
    public static String getRuleName(Integer hour){
        if (hour>= AM_TIP.getStartHour()&& hour<AM_TIP.getEndHour()){
            return AM_TIP.getName();
        }else if (hour>= PM_TIP.getStartHour()&& hour<PM_TIP.getEndHour()){
            return PM_TIP.getName();
        }else if (hour>= PEAK.getStartHour()&& hour<PEAK.getEndHour()){
            return PEAK.getName();
        }else if (hour>= FLAT.getStartHour()&& hour<FLAT.getEndHour()){
            return FLAT.getName();
        }else{
            return VALLY.getName();
        }
    }
    public Integer getStartHour() {
        return startHour;
    }

    public void setStartHour(Integer startHour) {
        this.startHour = startHour;
    }

    public Integer getEndHour() {
        return endHour;
    }

    public void setEndHour(Integer endHour) {
        this.endHour = endHour;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
}
